<?php
session_start();
$webroot="../";
require_once '../header.php';
function __autoload($className)
	{
    	require_once('../class/' . $className . '.class.php');
	}
session::need_manage();
$Plan=strval($_GET["plan"]);
$verify=verify::check($Plan);
if($verify==0)
	{
		$getAgentCountry=database::LimitQuery("country",array(
		'select' => 'country_code',
		'condition' => array(
		'agent_class' => $Plan
		)
		));
		$i=0;
		foreach($getAgentCountry as $countrList)
		{
			
			$countryCode=$countrList['country_code'];
			$arrReturn[$i]['country'] = $countryCode;
			$getPrice=database::LimitQuery("agent_price",array(
			'select' => 'agent_price',
			'condition' => array(
			'agent_name' => $Plan,
			'country' => $countryCode,
			
			),
			'offset' => '0',
			'size' => '1'
			
			));
			if(empty($getPrice))
			{
				$getPrice=database::LimitQuery("agent_price",array(
				'select' => 'agent_price',
				'condition' => array(
				'agent_name' => $Plan,
				'country' => 'all'
				),
				'offset' => '0',
				'size' => '1'
				));
				$arrReturn[$i]['price'] = $getPrice[0]['agent_price'];
			}
			$arrReturn[$i]['price'] = $getPrice[0]['agent_price'];

		$i++;	
		}
		require_once '../html/updateAgentPrice.php';
	}



?>